class CreateAttachments < ActiveRecord::Migration[5.1]
  def change
    create_table :attachments do |t|
      t.string :url, comment: '网址'
      t.string :name, comment: '别名'
      t.string :attachable_type, comment: '对应OBJ'
      t.integer :attachable_id, comment: '对应id'
      t.integer :created_by, comment: '创建人'

      t.timestamps
    end
    add_index :attachments, :attachable_id
    add_index :attachments, :attachable_type
    add_index :attachments, :created_by
  end
end
